/**
 * 获取属性调整值
 * @param abilityScore:属性值
 */
getAbilityModifier = abilityScore => {
  var modifier = 0;
  if (abilityScore % 2 == 1) {
    modifier = (abilityScore - 11) / 2;
  } else {
    modifier = (abilityScore - 10) / 2;
  }
  return modifier;
}

/**
 * 获取法术奖励
 * @param modi:属性修正值,
 */
getSkillWard = modi => {
  var maxWard = parseInt(Math.ceil(modi / 4));
  var wardArray = [];
  for (var i = 0; i < 9; i++) {
    var maxArea = modi % 4;
    maxArea = maxArea == 0 ? 4 : maxArea;
    if (i < maxArea) {
      wardArray[i] = maxWard
    } else {
      var ward = maxWard - parseInt((i - maxArea) / 4) - 1;
      ward = ward >= 0 ? ward : 0;
      wardArray[i] = ward
    }
  }
  return wardArray
}

module.exports = {
  getSkillWard: getSkillWard,
  getAbilityModifier: getAbilityModifier
}